﻿<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%option explicit%>
<%
Dim RZ_IN
RZ_IN=1
%>
<!--#include file="../conn.inc.asp" -->
<!--#include file="admin_inc/admin.function.asp" -->
<!--#include file="admin_inc/admin.sqlfunction.asp" -->
<!--#include file="admin_inc/md5.asp" -->
<%
'作者：山林客（ah_bill）
'博客：http://ruizhinet.blog.163.com
'网站：http://www.ruizhinet.cn
'本信息不会影响您网站的正常访问，请保留
checkadmin(1)
dim act,id,password,question,answer,rsa2,sqla2,rsa,id2,name,sqlt
act=HTMLEncode(request.Form("act"))
If act="modifypassword" Then
	password=HTMLEncode(request.Form("password"))
	id=HTMLEncode(request.Form("id"))
	question=HTMLEncode(request.Form("question"))
	answer=HTMLEncode(request.Form("answer"))
	If password="" Then
	response.redirect("showmsg.asp?from=modifypassword.asp&msg=")
	response.end
	Else
	Set rsa2 = Server.CreateObject("ADODB.Recordset")
	sqla2 = "select * from [c_user] where id="&id
	rsa2.open sqla2,conn,1,3
	If Not rsa2.eof And Not rsa2.bof Then 
	rsa2("password")=md5(password)
	rsa2("question")=question
	rsa2("answer")=answer
	rsa2.update
	End If 
	rsa2.close
	Set rsa2=Nothing
	response.redirect("showmsg.asp?from=user_modifypassword.asp&msg=ModifySuccess")
	End if
End If 
Set rsa = Server.CreateObject("ADODB.Recordset")
sqlt = "select * from [c_user] where name='"&session("user_name")&"'"
rsa.open sqlt,conn,1,1
If rsa.eof Or rsa.bof Then 
response.redirect("showmsg.asp?from=admin_home.asp&msg=NoRecord")
response.End
Else
id2=rsa("id")
name=rsa("name")
password=rsa("password")
question=rsa("question")
answer=rsa("answer")
End If 
rsa.close
Set rsa=Nothing 
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>修改密码</title>
<link type="text/css" href="style/style.css" rel="stylesheet" rev="stylesheet"/>
<script type="text/javascript" language="javascript" src="admin_js/net.js"></script>
<script type="text/javascript" language="JavaScript" src="admin_js/common.js"></script> 
</head>
<body>
<span id="result"></span>
<form method="post" name="rzform" action="user_modifypassword.asp" id="rzform">
<input type="hidden" name="id" value="<%=id2%>">	
<input type="hidden" name="act" value="modifypassword">	
<table cellspacing="0" cellpadding="0" class="table_400">
<tr>
	<th colspan="2">修改密码</th>
</tr>
<tr class="row">
	<td>原密码</td>
	<td><input type="password" id="oldpassword" name="oldpassword" value=""><span id="msg"></span></td>
</tr>
<tr class="row">
	<td>新密码</td>
	<td><input type="password" id="password"  name="password" onfocus="ajax_checkoldpwd();"  onkeyup="check_strength('password','password_display');"><span id="password_tips" style="display:none;">密码强度：</span>
<span id="password_display"></span></td>
</tr>
<tr class="row">
	<td>重复新密码</td>
	<td><input type="password" id="repassword"  name="repassword" onfocus="ajax_checkoldpwd();"></td>
</tr>
<tr class="row">
	<td>安全提问</td>
	<td>
	<select id="question" name="question">
		<option value="母亲的名字" <%If question="母亲的名字" Then response.write("selected=""selected""") End If%>>母亲的名字</option>
		<option value="爱人的名字" <%If question="爱人的名字" Then response.write("selected=""selected""") End If%>>爱人的名字</option>
		<option value="父亲出生的城市" <%If question="父亲出生的城市" Then response.write("selected=""selected""") End If%>>父亲出生的城市</option>
		<option value="您最尊敬的老师的名字" <%If question="您最尊敬的老师的名字" Then response.write("selected=""selected""") End If%>>您最尊敬的老师的名字</option>
		<option value="您手机的型号" <%If question="您手机的型号" Then response.write("selected=""selected""") End If%>>您手机的型号</option>
		<option value="您最喜欢的食物" <%If question="您最喜欢的食物" Then response.write("selected=""selected""") End If%>>您最喜欢的食物</option>
		<option value="您宠物的名字" <%If question="您宠物的名字" Then response.write("selected=""selected""") End If%>>您宠物的名字</option>
		<option value="只有我知道的问题" <%If question="只有我知道的问题" Then response.write("selected=""selected""") End If%>>只有我知道的问题</option>
		<option value="山林客代号" <%If question="山林客代号" Then response.write("selected=""selected""") End If%>>山林客代号</option>
	</select>
	</td>
</tr>
<tr class="row">
	<td>答案</td>
	<td><input name="answer" id="answer" type="text" size="20" maxlength="50" value="<%=answer%>"/>
</td>
</tr>
<tr class="row">
	<td colspan="2" class="tdcenter"><input id="btnsave" class="btn" type="button" value="保存" onclick="checkForm('modifypwd');">&nbsp;&nbsp;<input type="button"  class="btn" onclick="reset_checkoldpwd();" value="重置"></td>
</tr>
</table>
 </form>
</body>
</html>